<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@page import="java.sql.*" %><!-- 数据库操作需要 -->  
    <%@page import="beans.*" %>
<%@page import="java.util.List" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>我的任务</title>
    <link rel="stylesheet" href="UC_style.css">
    <style>
    
    	.main {
            width: 100%;
            height: 800px;
            background: RGB(239,239,239);
            float: left;
        }
        
        #header2 {
            height: 40px;
            background: white;
        }

        h3 {
            text-align: center;
            margin-top: 10px;
            margin-bottom: 10px;
            color: black;
        }

        table {
            width: 100%;
            border-collapse: collapse;
            margin-top: 20px;
        }

        th, td {
            text-align: center;
            padding: 10px;
            border-bottom: 1px solid #ddd;
        }

        .th1 {
            background-color: #ddd;
        }
        .button1 {
            background-color: RGB(239,239,239);
            border: none;
            color: #0094ff;
            width: 100px;
            font-size: 16px;
            text-align: center;
        } 
        .black_overlay {
            display: none; /* 此元素不会被显示*/
            position: absolute;
            top: 0%;
            left: 0%;
            width: 100%;
            height: 100%;
            background-color: black;
            z-index: 1001; /* z-index 属性设置元素的堆叠顺序。拥有更高堆叠顺序的元素总是会处于堆叠顺序较低的元素的前面。*/
            opacity: 0.8;
            opacity: .80; /* opacity 属性设置元素的不透明级别。*/
            filter: alpha(opacity=88);
            /* 所有浏览器都支持 opacity 属性。   注释：IE8 以及更早的版本支持替代的 filter 属性。例如：filter:Alpha(opacity=50)。*/
        }

        .white_content {
            display: none;
            position: absolute;
            top: 25%;
            left: 25%;
            width: 55%;
            height: 55%;
            padding: 20px;
            border: 10px solid #00ffff;
            background-color: white;
            z-index: 1002;
            overflow: auto;
        }
        .button_file {
            background-color: white;
            color: RGB(64,158,255);
            height: 22px;
            text-align: center;
            font-size: 16px;
            border: none;
            font-weight: bold;
        }

            .button_file:hover {
                background-color: RGB(249,249,249);
            }

            .button_file:active {
                transform: translateY(2px);
            }
        .text {
            border: none;
            height: 50px;
            width: 100%;
            font-size: 16px;
        }

        select {
            border: 0px;
            height: 90%;
            width: 90%;
            outline: none;
        }

        textarea {
            border: 0px;
            width: 100%;
            resize: none;
            font-size: 16px;
        }
        .input1 {
            border: none;
            height: 90%;
            width: 100%;
            font-size: 16px;
            outline: none;
        }

        .input2 {
            color: black;
            background-color: RGB(239,239,239);
            font-size: 20px;
            height: 40px;
            width: 100px;
            margin-left: 450px;
            margin-right: 30px;
        }

            .input2:hover {
                background-color: #808080;
            }
        
    </style>
</head>
<body>
<%
	String first=(String)request.getAttribute("first");
	if(first==null)
	{
		request.setAttribute("action", "C_Check_Search");
	%>
		<script type="text/javascript">
			window.location.href="C_Servlet?action=C_DriverTask_Search&tt=2";
		</script>
	<% 
	}
	String addok=(String)request.getAttribute("addok");
	String Did=(String)session.getAttribute("Did"); 
	if(addok!=null&&addok.equals("1"))
	{%>
	<script type="text/javascript">
		alert("删除成功！");
	</script>
	<% }	
	if(addok!=null&&addok.equals("2"))
	{%>
	<script type="text/javascript">
		alert("修改成功！");
	</script>
	<% }

	//String sql="select * from Driver_Task_view where Did='"+Did+"'";

	
	List <Driver_TaskBean> list=(List<Driver_TaskBean>)request.getAttribute("allUsers");
%>	
    <div class="main">
        <div id="header2">
            <img src="img/frist.png" alt="Big Boat" width="30" height="30" style=" vertical-align: middle;">
            司机端 > 我的任务
        </div>
        <h3>任务大厅</h3>
        <table>
            <thead>
                <tr>
                    <th class="th1">序号</th>
                    <th class="th1">申请人</th>
                    <th class="th1">联系电话</th>
                    <th class="th1">用车时间</th>
                    <th class="th1">返回时间</th>
                    <th class="th1">乘车人数</th>
                    <th class="th1">起始里程</th>
                    <th class="th1">派车说明</th>                   
                    <th class="th1">操作</th>
                </tr>
            </thead>
            <tbody>
               <tbody>
                <%	
                if(list!=null){
    			for(int i=0;i<list.size();i++)
				{ 
					String RequestID=list.get(i).getRequestID();
					String UseTime=list.get(i).getUseTime();
					UseTime=UseTime.replace("T", " ");
					String ReturnTime=list.get(i).getReturnTime();
					ReturnTime=ReturnTime.replace("T", " ");
					String Did1=list.get(i).getDid();
					
					if(!Did1.equals(Did))
							continue;
				%>
					<tr  >
						<td>
							<%=RequestID %>
						</td>
						<td>
							<%=list.get(i).getapplicant()%>
						</td>
						<td>
							<%=list.get(i).getUsePhone()%>
						</td>
						<td>
							<%=UseTime %>
						</td >
						
						<td>
							<%=ReturnTime %>
						</td>
						<td>
							<%=list.get(i).getUersNum()%>
						</td>					
						<td>
							<%=list.get(i).getkm() %>
						</td>	
						<td>
							<%=list.get(i).getinstructions()%>
						</td>										
						<td>
                        	<button class="button1" onclick="document.getElementById('light').style.display='block';document.getElementById('fade').style.display='block'">查看</button>
                   		 </td>
					</tr>
					<%}} %>
            </tbody>
                
                    
            </tbody>
        </table>

        <div id="light" class="white_content">
            <form>
                <table class="had">
                    <tr>
                        <th>乘车人数：</th>
                        <td><input class="input1" type="number" id="passengers" name="passengers" min="1" max="6" value="3" disabled="disabled"></td>
                        <th>申请人：</th>
                        <td>
                            <input class="input1" type="text" id="name" name="name" value="李某某" disabled="disabled">
                        </td>
                        <th>联系电话：</th>
                        <td><input class="input1" type="text"  value="15588886666" disabled="disabled"></td>
                    </tr>
                    <tr>
                        <th>用车时间：</th>
                        <td><input class="input1" type="datetime-local" id="date" name="date" value="2023-4-10 10:00" disabled="disabled"></td>
                        <th>返回时间：</th>
                        <td><input class="input1" type="datetime-local" id="date" name="date" value="2023-4-10 10:00" disabled="disabled"></td>
                        <th>起始里程：</th>
                        <td>
                            <input class="input1" type="number" id="km" name="km" step="0.1" required>
                        </td>
                    </tr>
                    <tr>
                        <th>起始地点</th>
                        <td colspan="2"><input class="input1" type="text" value="南昌航空大学" disabled="disabled" /></td>
                        <th>前往地点</th>
                        <td colspan="2"><input class="input1" type="text" value="南昌航空大学" disabled="disabled" /></td>
                    </tr>
                    <tr>
                        <th style="height:50px">附件</th>
                        <td colspan="5" style="text-align:left">
                            <input type="button" class="button_file" value="添加附件" onclick="path.click()" disabled="disabled">
                            <input type="text" class="text" name="lookfile" id="lookfile" style="outline:none;" readonly>
                            <input type="file" id="path" style="display:none" onchange="lookfile.value+='   '+this.value">
                        </td>
                    </tr>
                   
                    <tr>
                    	<th style="height:50px">派车情况说明</th>
                        <td colspan="5"><textarea rows="3" cols="30" style="outline:none;" placeholder="请输入派车情况说明" required></textarea></td>
                    </tr>
                </table>
                <br />
                <button type="submit" style="height:40px;width:80px;font-size:20px;margin-left:40px" onclick="document.getElementById('light').style.display = 'none'; document.getElementById('fade').style.display = 'none';test()">接取</button>
                <button style="height:40px;width:80px;font-size:20px;margin-left:40px" onclick="document.getElementById('light').style.display='none';document.getElementById('fade').style.display='none'">返回</button>
            </form>
        </div>
        <div id="fade" class="black_overlay"></div>
    </div>

    <script>
        function displayAlert(type, data, time) {

            var lunbo = document.createElement("div");

            if (type == "success") {
                lunbo.style.backgroundColor = "#009900";
            }
            else {
                console.log("入参type错误");
                return;
            }

            lunbo.id = "lunbo";
            lunbo.style.position = "absolute";
            lunbo.style.width = "200px";
            lunbo.style.height = "60px";
            lunbo.style.top = "50%";
            lunbo.style.marginLeft = "50%";
            lunbo.style.color = "white";
            lunbo.style.fontSize = "25px";
            lunbo.style.borderRadius = "20px";
            lunbo.style.textAlign = "center";
            lunbo.style.lineHeight = "60px";

            if (document.getElementById("lunbo") == null) {
                document.body.appendChild(lunbo);
                lunbo.innerHTML = data;
                setTimeout(function () {
                    document.body.removeChild(lunbo);
                }, time);
            }
        }
        function test() {
            displayAlert("success", "接取成功", 1500);
            document.getElementById("a").innerHTML = "已接取";
        }
    </script>
</body >
</html >
